package com.ttg.controller;

//~--- non-JDK imports --------------------------------------------------------

import com.ttg.contants.TestContants;
import com.ttg.contants.UrlContants;
import com.ttg.pojo.UserBindPojo;
import com.ttg.security.EncryptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

//~--- classes ----------------------------------------------------------------

/**
 * Class UserBindDemoController
 * Description
 * Create 2016-06-23 17:40:49
 * @author Ardy
 */
@Controller
@RequestMapping("/user_bind")
public class UserBindDemoController {

    /**
     * Field logger
     * Description
     */
    private static final Logger logger = LoggerFactory.getLogger(UserBindDemoController.class);

    /**
     * Method testUserBind
     * Description 说明：
     *
     * @param model 说明：
     *
     * @return 返回值说明：
     */
    @RequestMapping
    public String testUserBind(Model model) {
        UserBindPojo userBindPojo = new UserBindPojo();

        userBindPojo.setMerchantId(TestContants.MERCHANT_ID);
        userBindPojo.setAppId(TestContants.APP_ID);
        userBindPojo.setBankId(TestContants.BANK_ID);
        userBindPojo.setCardType(TestContants.CARD_TYPE);
        userBindPojo.setCardNo(TestContants.CARD_NO);
        userBindPojo.setSignatureAlgorithm(TestContants.SIGNATUREALGORITHM);
        userBindPojo.setUserId(TestContants.USER_ID);
        userBindPojo.setSignatureInfo(EncryptionUtils.encryption(userBindPojo.getAllParameters()));
        model.addAttribute("userBind",userBindPojo);
        model.addAttribute("userBindUrl", UrlContants.USER_BIND);
        return "demo/user_bind_demo";
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
